#include <iostream>
using namespace std;

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int main()
{
    int n, a;
    while (cin >> n >> a)
    {
        int c;
        while (n--)
        {
            scanf("%d", &c);
            if (a >= c)
            {
                a += c;
            }
            else
            {
                a += gcd(a, c);
            }
        }
        printf("%d\n", a);
    }
    return 0;
}
